// DatePicker

@import '../../style/themes/default';
@import '../../style/mixins/index';
@import './param';

@mixin date-picker {
  width: 100%;
  @include flex();
  > label {
    display: inline-block;
    height: $--x-date-picker-height;
    line-height: $--x-date-picker-height;
    color: $--x-text-300;
    font-weight: 600;
    @include text-align();
  }
  > .#{$--x-date-picker-prefix}-row {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    > x-input {
      > .x-input {
        > .x-input-row {
          > input {
            cursor: pointer;
          }
        }
      }
    }
  }
  &.x-required {
    &.x-required-show {
      > label {
        color: $--x-danger;
      }
    }
  }
  &.x-disabled {
    > .#{$--x-date-picker-prefix}-row {
      > x-input {
        > .x-input {
          > .x-input-row {
            > input {
              cursor: not-allowed;
            }
          }
        }
      }
    }
  }
  &.x-flex {
    &.x-direction {
      &-row {
        > label {
          padding: 0 0.5rem 0 0;
        }
      }
      &-row-reverse {
        > label {
          padding: 0 0 0 0.5rem;
        }
      }
      &-column {
        align-items: inherit;
      }
      &-column-reverse {
        align-items: inherit;
      }
    }
  }
}

@mixin date-picker-portal {
  $prefix: $--x-date-picker-portal-prefix;
  margin: 0.0625rem 0;
  font-size: $--x-date-picker-font-size;
  color: $--x-text;
  border: $--x-date-picker-border;
  border-radius: $--x-border-radius;
  box-shadow: $--x-box-shadow-light;
  background-color: $--x-background;
  width: 16rem;
  display: flex;
  flex-direction: column;
  font-size: $--x-font-size-small;
  &.date-time {
    width: 27rem;
  }
  &.date-hour {
    width: 19.75rem;
  }
  &.date-minute {
    width: 23.375rem;
  }
  &-content {
    display: flex;
  }
  &-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem;
    border-bottom: $--x-border-width solid $--x-border;
  }
  &-year-month {
    flex: 1;
    text-align: center;
  }
  &-body {
    padding: 0.4rem;
  }
  &-footer {
    display: flex;
    justify-content: flex-end;
    border-top: $--x-date-picker-border;
    padding: 0.5rem;
  }
  &-date {
    flex: 1;
  }
  &-time {
    display: flex;
    flex-direction: column;
    &-label {
      padding: 0.4rem;
      text-align: center;
      border-left: $--x-date-picker-border;
    }
    .x-time-picker-frame {
      border-width: $--x-border-width 0 0 $--x-border-width;
      box-shadow: none;
    }
  }
}

@mixin picker-date {
  &-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    th {
      font-weight: 400;
      height: 2rem;
    }
    td {
      height: 2rem;
      padding: 0.125rem 0;
      text-align: center;
      x-button .x-button {
        width: 1.625rem;
        height: 1.5rem;
        margin: 0 auto;
        border: 0.0625rem solid transparent;
        &:hover {
          background-color: $--x-primary-900;
        }
        &-activated {
          color: $--x-background-100;
          background-color: $--x-primary;
          &:hover {
            color: $--x-background-100;
            background-color: $--x-primary;
          }
        }
      }
      &.x-date-last-or-next x-button .x-button {
        color: $--x-text-400;
      }
      &.x-date-now x-button .x-button {
        color: $--x-primary;
        background-color: transparent;
        border-color: $--x-primary;
      }
    }
  }
}

@mixin picker-month {
  &-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    td {
      height: 1.875rem;
      padding: 0.125rem 0;
      text-align: center;
      x-button .x-button {
        width: 2.6rem;
        height: 1.6rem;
        margin: 0 auto;
        border: 0.0625rem solid transparent;
        &:hover {
          background-color: $--x-primary-900;
        }
        &-activated {
          color: $--x-background-100;
          background-color: $--x-primary;
          &:hover {
            color: $--x-background-100;
            background-color: $--x-primary;
          }
        }
      }
      &.x-date-last-or-next x-button .x-button {
        color: $--x-text-400;
      }
      &.x-date-now x-button .x-button {
        color: $--x-primary;
        background-color: transparent;
        border-color: $--x-primary;
      }
    }
  }
}

@mixin picker-year {
  &-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    td {
      height: 1.875rem;
      padding: 0.125rem 0;
      text-align: center;
      x-button .x-button {
        width: 2.6rem;
        height: 1.6rem;
        margin: 0 auto;
        border: 0.0625rem solid transparent;
        &:hover {
          background-color: $--x-primary-900;
        }
        &-activated {
          color: $--x-background-100;
          background-color: $--x-primary;
          &:hover {
            color: $--x-background-100;
            background-color: $--x-primary;
          }
        }
      }
      &.x-date-last-or-next x-button .x-button {
        color: $--x-text-400;
      }
      &.x-date-now x-button .x-button {
        color: $--x-primary;
        background-color: transparent;
        border-color: $--x-primary;
      }
    }
  }
}
